<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018-11-24
 * Time: 14:43
 */

namespace app\admin\controller;


use app\common\controller\AdminBase;
use app\common\model\Personal;
use think\Db;

class Personalreal extends AdminBase
{

    /**
     * 认证列表
     */
    public function index($keyword = '', $page = 1)
    {
        $map = [];
        if ($keyword) {
            $map['u_phone|u_email|u_nickname'] = trim($keyword);
        }
        $list = Personal::personalList($map, $page);
        $allnum     = Db::name('personal_real_name')->count();//个人认证总数量
        $waitnum    = Db::name('personal_real_name')->where('prn_status', 1)->count();//待审核
        $passnum    = Db::name('personal_real_name')->where('prn_status', 2)->count();//通过
        return $this->fetch('index', ['list' => $list, 'keyword' => $keyword, 'allnum' => $allnum, 'waitnum' => $waitnum, 'passnum' => $passnum]);

    }

    /**
     * 认证通过 不通过
     */
    public function authenticationPass()
    {
        $data            = $this->request->param();
        $data['prn_update_time'] = time();
        $status = Personal::edit($data);
        if ($status) {
            $this->success('更新成功');
        } else {
            $this->error('更新失败');
        }
    }

}